/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
$(document).ready(function() {
    // set up the news accordion on the lower page
    /*$("#birthday").datepicker({
        changeMonth: true,
        changeYear: true
    });*/

    // create the image rotator
    setInterval("rotateImages()", 2000);
    $("div#status").hide();
    $("input#check").button().click(fetch_status);
});
function rotateImages() {
    var oCurPhoto = $('#photoShow div.current');
    var oNxtPhoto = oCurPhoto.next();
    if (oNxtPhoto.length == 0)
        oNxtPhoto = $('#photoShow div:first');

    oCurPhoto.removeClass('current').addClass('previous');
    oNxtPhoto.css({opacity: 0.0}).addClass('current').animate({opacity: 1.0}, 1000,
                function() {
                    oCurPhoto.removeClass('previous');
                });
}
function fetch_status()
{
    var postdata = "appid="+$('#id').val();
       // alert(postdata);
    $.ajax({
                type: 'POST',
                url: base_url() + 'customer/complain_fetch_ajax',
                data: postdata,
                datatype: 'json',
                success : function (result) {
                    var data=$.parseJSON(result);
                  //  alert(data.appid);
                    var html="Application ID: "+data.appid+"<br/><br/>"+
                  "Date of apply: "+data.applydate+"<br/><br/>"+
                  "Status: "+data.message+"<br/><br/>"+
                  "Date of accomplish: "+data.accomplishdate+"<br/><br/>";
                  //"Last updated on: "+data.updatedate;
                    if (data.appid != -1) {
                        $("div#status fieldset p").html(html);
                        $("div#status").show("slide");
                    } else {
                         alert("Wrong information");
                    }
                }
            });

}


